<?php
	/**
	 * 获取场馆列表
	 */
    class GameList extends APIBase {
		
		public $tag = "GameList";
		public $isLogin = false;
		
		public function before() {
			$this->initCacheRedis();
			return true;
		}
       
		public function logic() {
			$gameids = $this->cache_redis->lRange("game:ids", 0, -1);
			$games = array();
			
			//var_dump($this->cache_redis->hGetAll('honline'));
			//exit;
			//读取房间人数
			//$honline = $this->cache_redis->hGetAll('honline');
			
			foreach ($gameids as $vid) {
				
				$game = $this->cache_redis->hMGet("game:{$vid}", array("NameID", "GameName", "DeskPeople", "GameKind", "ServiceVersion"));
				$row['NameID'] = (int) $vid;
		
				$row['GameName'] = $game['GameName'];
				$row['DeskPeople'] = $game['DeskPeople'];
				$row['GameKind'] = $game['GameKind'];
				$row['ServiceVersion']  = $game['ServiceVersion'];
				
				$games[] = $row;
				
				
			}
			$this->returnData(array('games' => $games));
		}
		
    	public function after() {
			$this->deinitCacheRedis();
		}
    }
?>
